package com.fc.advbox.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.fc.advbox.dao.*;
import com.fc.advbox.entity.AdvOrgEntity;
import com.fc.advbox.entity.ContractEntity;
import com.fc.advbox.entity.ContractEquipmentEntity;
import com.fc.advbox.entity.PublicTokenEntity;
import com.fc.advbox.service.IContractService;
import com.fc.advbox.service.IEquipmentHoldingService;
import com.fc.advbox.service.IOrgService;
import com.fc.advbox.service.IPublicTokenService;
import com.fc.advbox.utils.Constant;
import com.fc.advbox.utils.RRException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import static com.fc.advbox.service.impl.OrgServiceImpl.DEFAULT_ORG_NAME;

/**
 * ContractServiceImpl
 *
 * @author Gary.Jiang
 * @date 2018/6/22.15:52
 */
@Service("publicTokenService")
@Transactional
@Slf4j
public class PublicTokenServiceImpl extends BaseServiceImpl<PublicTokenEntity> implements IPublicTokenService {
    @Autowired
    private PublicTokenDao publicTokenDao;

    @Override
    public BaseDao getDao() {
        return publicTokenDao;
    }

    public PublicTokenEntity queryObject(Map<String, Object> map){
        List<PublicTokenEntity> tokenList = publicTokenDao.queryList(map);
        if(tokenList != null && tokenList.size()>0){
            return tokenList.get(0);
        }
        return null;
    }
}
